﻿// defines search module and view states
angular.module('app.search', ['app.common'])
    .config(['$stateProvider', function ($stateProvider) {
    	'use strict';
    	$stateProvider
			// base search screen
            .state('search', {
            	url: '/',
            	templateUrl: '/app/search/views/SearchSplash.html',
            	controller: 'SearchController'
            })
			// search results base view state
			.state('search-results', {
				url: '/search',
				templateUrl: '/app/search/views/SearchResults.html',
				controller: 'SearchResultsContainerController'
			})
			// search by image
    		.state('search-results.by-image', {
    			url: '/image/{tolerance}/{imageId}',
    			views: {
    				'search-criteria': {
    					templateUrl: '/app/search/views/SearchByImageCriteria.html',
    					controller: 'SearchResultsByImageController'
    				}
    			}
    		})
			// search by pattern
			.state('search-results.by-pattern', {
				url: '/pattern/{tolerance}/{patternId}',
				views: {
					'search-criteria': {
						templateUrl: '/app/search/views/SearchByPatternCriteria.html',
						controller: 'SearchResultsByPatternController'
					}
				}
			})
			// search by color
			.state('search-results.by-color', {
				url: '/color/{colors}',
				views: {
					'search-criteria': {
						templateUrl: '/app/search/views/SearchByColorCriteria.html',
						controller: 'SearchResultsByColorsController'
					}
				}
			});
    }]);